<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			//要求，定义个公共的方法，能够实现只需要接收要互换的两个节点，
			//然后调用这个方法，节点实现互换
			window.onload=function (){
				function c(a,b){
				if(a==null||b==null){
					console.log("数据错误，替换失败")
				}else{
					var getid=document.getElementById(a);
				    var getid2=document.getElementById(b);
				var clonea1=getid.cloneNode(true);
				var clonea2=getid2.cloneNode(true);
				var a2=getid.parentNode;
				var b2=getid2.parentNode;
				a2.replaceChild(clonea1,getid2);
				b2.replaceChild(clonea2,getid);
			}
			
				}
			
			c("game","city");	
			}
		</script>
	</head>
	<body>
				<p>你喜欢那个城市</p>
		<ul id="city">
			<li id="bj" name="beijing">北京</li>
			<li>上海</li>
			<li>苏州</li>
			<li>泉州</li>
		</ul>
		
		<br><br>
		<p>你喜欢那个游戏</p>
		<ul id="game">
			<li id="gm" >红警</li>
			<li>魔兽</li>
			<li>侠盗猎车</li>
			<li>罪恶都市</li>
		</ul>
		<br><br>
		
		gender:
		<input type="radio">
		<button id="button">点我</button>
		<button id="button2">点我2</b
	</body>
</html>
